{
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "#### 字典初始"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "markdown",
   "id": "292f648b",
   "metadata": {},
   "source": [
    "### vowels.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e0e995ac",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "i\n",
      "i\n",
      "a\n"
     ]
    }
   ],
   "source": [
    "vowels = ['a','e','i','o','u']\n",
    "word = \"Milliways\"\n",
    "# 检查 word中出现的 元音，并打印出来 怎么做？\n",
    "for letter in word:  # 第一个元素letter 请不要和已有变量重名\n",
    "                     # 第一个元素一般不定义名字，常用item(译：元素)来命名\n",
    "                     #                         或简写 i 来命名\n",
    "                     # 第二个元素word （最重要的） ，意味着将遍历的内容\n",
    "                     # 遍历的内容一般是 序列数据 str list\n",
    "    if letter in vowels:\n",
    "        print(letter)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "93614c89",
   "metadata": {},
   "source": [
    "### vowels2.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "83cd03ae",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['i', 'a']\n"
     ]
    }
   ],
   "source": [
    "# 使用append（）新建列表\n",
    "found = []\n",
    "vowels = ['a','e','i','o','u']\n",
    "word = \"Milliways\"\n",
    "for letter in word:\n",
    "    if letter in vowels:\n",
    "        if letter not in found:\n",
    "            found.append(letter)\n",
    "print(found)\n",
    "        \n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "source": [
     "\n",
     "\n"
    ],
    "metadata": {
     "collapsed": false
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}